-
-
Notifications
You must be signed in to change notification settings - Fork 360
Forward euler implementation in Common Lisp #607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Forward euler implementation in Common Lisp #607
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just minor indentation stuff.
(loop | ||
with result = (make-array n :initial-element 1) | ||
for i from 1 upto (1- n) do | ||
(setf (svref result i) (- (svref result (1- i)) (* 3 (svref result (1- i)) timestep))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this should be indented.
with approximatep = t | ||
with solution = 0 | ||
for i from 0 upto (1- (length result)) do | ||
(setf solution (exp (* (- 3) i timestep))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar indentation question here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @berquist, what is wrong with the indentation exactly? How many spaces should (setf ...
be indented with?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I should learn to read. I disagree that it shouldn't be indented, because do
introduces a code block, that reads different to the loop syntax
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like you're getting indentation within the do
section and I am not. When I use emacs -Q
to remove all my customizations, the entire loop
body is unindented.
In addition a very loose style guide (https://lisp-lang.org/style-guide/) plus reading somewhere else that it doesn't really matter that much, these are nitpicks that can be ignored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just pressed tab on the code and found that it unindented the code. I apparently made the decision half a year ago that this would be easier to read. I don't really care that much now and it should still be fine, so I'll put the code back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, leave it as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well now I've changed it.
This is stupid, just merge it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore my previous nits, everything looks good and works properly.
A review is appreciated!